#ifndef BASEUDP_H
#define BASEUDP_H

#include <QUdpSocket>

class BaseUdp : public QUdpSocket
{
    Q_OBJECT
public:
    explicit BaseUdp(QObject *parent = nullptr);
    ~BaseUdp();

signals:
    void emitData(QByteArray ba);
    void netStateSignals(int e);

public slots:
    ///连接网络
    ///
    void onSetting();
    void onConnect(QString ip, int port);
    void onSend( QString command);
    void onDisconnect();

    ///
    /// \brief on_connected
    ///tcp 状态
    void onConnected();
    void onDisconnectd();
    void onRead();
    void onError(QAbstractSocket::SocketError e);
    void onStateChange(QAbstractSocket::SocketState e);

private:
    void initConnect();

    QHostAddress _ip;
    int _port;
};

#endif // BASEUDP_H
